import React from 'react';
import { Button } from 'antd';

class Star extends React.PureComponent {
	onClick = () => {
		const { onClick, starIndex, starScore, starRemark } = this.props;
		if (typeof onClick === 'function') onClick({ starIndex, starScore, starRemark });
	}
	onMouseEnter = () => {
		const { starIndex, onMouseEnter } = this.props;
		if (typeof onMouseEnter === 'function') onMouseEnter(starIndex);
	}
	onMouseLeave = () => {
		const { onMouseLeave } = this.props;
		if (typeof onMouseLeave === 'function') onMouseLeave();
	}
  render() {
		return (<i {...this.props} onClick={this.onClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave} />);
  }
}

export default Star;
